export const routes = [
  {
    path: '/',
    redirect: '/home',
    component: () => import('@/layout/basic/index.vue'),
    children: [
      {
        path: 'home',
        component: () => import('@/views/home/index.vue'),
        meta: {
          // title: 'tabbar.home',
          keepAlive: true,
        },
      },
      {
        path: 'detection',
        component: () => import('@/views/detection/index.vue'),
        meta: {
          title: '语音检测',
          keepAlive: true,
        },
      },
      {
        path: 'detection/result',
        component: () => import('@/views/detection/result.vue'),
        meta: {
          title: '分析结果',
          keepAlive: false,
        },
      },
      {
        path: 'list',
        component: () => import('@/views/study/index.vue'),
        meta: {
          title: '学习中心',
          keepAlive: true,
        },
      },
      {
        path: 'quiz',
        component: () => import('@/views/list/index.vue'),
        meta: {
          title: '刷题练习',
          keepAlive: true,
        },
      },
      {
        path: 'member',
        component: () => import('@/views/member/index.vue'),
        meta: {
          // title: 'tabbar.member',
          keepAlive: true,
        },
      },
      {
        path: 'daily',
        component: () => import('@/views/daily/index.vue'),
        meta: {
          title: '每日一句',
          keepAlive: true,
        },
      },
      {
        path: 'game',
        component: () => import('@/views/game/index.vue'),
        meta: {
          title: '小游戏',
          keepAlive: true,
        },
      },
      {
        path: 'course/:id',
        component: () => import('@/views/course/detail.vue'),
        meta: {
          title: '课程详情',
          keepAlive: false,
        },
      },
      {
        path: 'video/:id',
        component: () => import('@/views/video/player.vue'),
        meta: {
          title: '视频播放',
          keepAlive: false,
        },
      },
      {
        path: 'study/progress',
        component: () => import('@/views/study/progress.vue'),
        meta: {
          title: '我的学习进度',
          keepAlive: false,
        },
      },

    ],
  },
  {    name: 'login',
    path: '/login',
    component: () => import('@/views/login/index.vue'),
    meta: {
      title: '',
      keepAlive: true,
    },
  },
  {
    name: 'register',
    path: '/register',
    component: () => import('@/views/register/index.vue'),
    meta: {
      title: '',
      keepAlive: true,
    },
  },
  // 匹配不到重定向会主页
  {
    // 找不到路由重定向到404页面
    path: '/:pathMatch(.*)',
    redirect: '/home',
  },
];

export default routes;
